package homework02;

import java.sql.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;

public class Test {
    public static void main(String[] args) {
        ArrayList<Movie> list = new ArrayList();
        Movie movie = new Movie("肖申克的救赎", "弗兰克·德拉邦特", "蒂姆·罗宾斯", 9.7);
        Movie movie1 = new Movie("霸王别姬", "陈凯歌", "张本领", 9.6);
        Movie movie2 = new Movie("阿甘正传", "弗兰克·罗伯特·泽米吉斯", "汤姆·汉克", 9.5);
        list.add(movie);
        list.add(movie1);
        list.add(movie2);
//       //list.iterator得到迭代器对象，默认指向当前集合的索引0
//        Iterator<Movie> it = list.iterator()
//        //通过迭代器获取集合的元素
//        while (it.hasNext()) {
//            Movie next =  it.next();
//            System.out.println(next);
//        }
        //增强for循环
        for (Movie movie3 : list) {
            System.out.println(movie3.toString());
        }
    }
}